<?php
session_start();
$_SESSION['mes']="Error! Please try again";
if(isset($_SESSION['admin_id'])) {
    include "../include/dbFunctions.php";
    $id = $_POST['id'];
    $name = $_POST['name'];

    for ($i=0;$i<count($id);$i++) {
        $n = $name[$i];
        $idd=$id[$i];
        $query1 = "UPDATE track_criteria
            SET track_criteria = '".$n."'
            WHERE track_id=$idd";
        //echo $query1."<br/>";
        $result1 = executeQuery($query1);
        if (($result1!=0)) {
            $_SESSION['mes']="The tracking criteria has been updated successfully.";
        } 
    }
    $link = "trackView.php";
    header("Location: $link");
}else {
    header("Location: ../include/login.html");
}
?>
